//
//  ViewController.swift
//  FaceVisionDemo
//
//  Created by 刘康 on 2021/6/24.
//

import UIKit

class ViewController: UIViewController {
    
    lazy var faceView: FaceVisionView = {
        let view = FaceVisionView()
        
        view.isAddFaceInfo = false
        // 根据回调的图片进行人脸对比/检测等操作
        view.checkFaceInfoBlock = { [weak self] image in
            
        }
        return view
    }()

    override func viewDidLoad() {
        super.viewDidLoad()
        view.addSubview(faceView)
        faceView.snp.makeConstraints { (make) in
            make.center.equalToSuperview()
            make.width.height.equalTo(250)
        }
    }

    // 点击屏幕重新检测
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        faceView.previewView?.subviews.forEach {$0.removeFromSuperview()}
        faceView.session?.startRunning()
    }

}

